<template>
  <div class="app-container">
    <ul class="tableList">
      <li v-for="(item,index) in tableList" :key="index" @click="gotoPage(index)" :class="active==index?`active`:``">{{item.name}}</li>
    </ul>
    <advertisementList v-if="showAdvertisementList"></advertisementList>
    <advReviewList v-if="showAdvReviewList"></advReviewList>
  </div>
</template>

<script>
  export default {
    name: 'index',
    components: {
      advertisementList: () => import('./advertisementList.vue'),
      advReviewList: () => import('./advReviewList.vue')
    },
    data() {
      return {
        active: 0,//默认的颜色,
        showAdvReviewList: true,//
        showAdvertisementList: false,//

        tableList: [
          {
            name: '广告审核',
            path: '/advertisingReviewList'
          },
          {
            name: '投放中广告',
            path: '/advertisementList'
          }
        ]
      }
    },
    created() {

    },
    watch: {},
    methods: {
      gotoPage(index) {
        this.active = index
        if (index == 0) {
          this.showAdvertisementList = false;
          this.showAdvReviewList = true;
        } else {
          this.showAdvReviewList = false;
          this.showAdvertisementList = true;
        }
      }
    }
  }
</script>

<style scoped lang="scss">
  .app-container {
    display: flex;
    height: 100vh;
    background: #F8F9FD;
    box-sizing: border-box;
    flex-direction: column;
    width: 100%;
  }

  .tableList {
    display: flex;
    border-bottom: 1px solid #eee;
    background: #fff;
    padding: 0px 20px;
    margin: 0;
    height: 54px;
    border-bottom: 10px solid #F8F9FD;


    li {
      display: flex;
      align-items: center;
      justify-content: center;
      font-size: 14px;
      padding: 0px 10px;
      position: relative;
      cursor: pointer;
      height: 44px;
      color: #8E8E8E;
      margin-right: 30px;

      &.active {
        font-weight: bold;
        color: #000;

        &:after {
          height: 2px;
          background: #1670F1;
          content: '';
          position: absolute;
          left: 10px;
          right: 10px;
          bottom: 0;

        }
      }
    }
  }
</style>
